<?php
class pdf {
            
    public function getpdft($punto,$acta,$subinciso,$inciso,$code,$carrera,$estudiantes,$enters){
        Yii::import('application.extensions.*');
        require_once('tcpdf/config/lang/eng.php');
        require_once('tcpdf/MYPDF.php');

        //$pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
        //PDF_PAGE_FORMAT
        $pdf = new MYPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, 'legal', true, 'UTF-8', false);
        //$pdf = Yii::createComponent('application.extensions.tcpdf.tcpdf', 
        //                          'P', 'cm', 'A4', true, 'UTF-8');
        // set document information
        $pdf->SetCreator(PDF_CREATOR);
        $pdf->SetAuthor('Yonatan Grajeda');
        $pdf->SetTitle('Constancia Cierre');
        $pdf->SetSubject('Pedagogia');
        $pdf->SetKeywords('TCPDF, PDF, example, test, guide');

        // set default header data
        $pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE, PDF_HEADER_STRING);

        // set header and footer fonts
        $pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN));
        $pdf->setFooterFont(Array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA));

        // set default monospaced font
        $pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);

        //set margins
        
        $pdf->SetMargins(PDF_MARGIN_LEFT-10, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT-5);
        //$pdf->SetFooterMargin(PDF_MARGIN_FOOTER);
        $pdf->SetHeaderMargin(PDF_MARGIN_HEADER);
        $pdf->SetFooterMargin(PDF_MARGIN_FOOTER);

        //set auto page breaks
        $pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);

        //set image scale factor
        $pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);

        //set some language-dependent strings
        $pdf->setLanguageArray($l);

        // ---------------------------------------------------------
        // set font
        $pdf->SetFont('times', '', 12);

        // add a page
        $pdf->AddPage();


        $cuerpo = "
        <br><br><br>
        <table>
        <tr>
            <th  width=\"5%\"><b>No.</b></th>
            <th width=\"40%\"><b>Nombres y apellidos Completos</b></th>
            <th width=\"15%\"><b>carné No.</b></th>
            <th width=\"15%\"><b>Fecha Cierre</b></th>
            <th width=\"28%\"><b>Sede</b></th>
        </tr>
        $estudiantes
        </table>
        $enters
            ";
       /* <tr >
        $estudiantes
            <td width=\"10%\">1</td>
            <td width=\"40%\">Yonatan Josue Grajeda Cuesi</td>
            <td width=\"15%\">200818812</td>
            <td width=\"20%\">10.06.2012</td>
            <td width=\"20%\">Cobán</td>
        </tr>*/
/*
        $punto="QUINTO";
        $acta="023-2012";
        $subinciso="5.5.11";
        $inciso="5.8";
        $code="438.15.10";
*/
        $datetime = new DateTime();
        $varTime=$datetime->format('Y/m/d');
        $fecha=  split("/", $varTime);
        //echo count($fecha)."---$varTime $fecha[0]";
        $mes=$pdf->getmes($fecha[1]);
        $colocarfecha="Guatemala, $fecha[2] de $mes del $fecha[0] ";
        //echo $colocarfecha;
        echo "<BR>";

        $html=  $pdf->encabezado($code,$carrera,$colocarfecha).$cuerpo.
                $pdf->pieFinal($punto,$acta,$subinciso,$inciso);

        $pdf->writeHTML($html, true, false, true, false, '');

        return $pdf;
    }
}
?>
